﻿using System;
using UnityEngine;
using UnityEngine.Events;

// Token: 0x02000179 RID: 377
public class CharaMoveController : MonoBehaviour
{
	// Token: 0x060009BE RID: 2494 RVA: 0x00039490 File Offset: 0x00037690
	protected virtual void Awake()
	{
		this.speedSlider.AddOnChangeAction(new UnityAction<float>(this.OnSpeedSlider));
	}

	// Token: 0x060009BF RID: 2495 RVA: 0x000394AC File Offset: 0x000376AC
	public void Setup(Transform trans)
	{
		this.moveTrans = trans;
		this.invoke = false;
		this.speedSlider.SetValue(this.speedRate);
		this.invoke = true;
	}

	// Token: 0x060009C0 RID: 2496 RVA: 0x000394D4 File Offset: 0x000376D4
	public void SetDef(Vector3 pos, Quaternion rot)
	{
		this.defPos = pos;
		this.defRot = rot;
	}

	// Token: 0x060009C1 RID: 2497 RVA: 0x000394E4 File Offset: 0x000376E4
	protected void OnSpeedSlider(float val)
	{
		if (!this.invoke)
		{
			return;
		}
		this.speedRate = val;
	}

	// Token: 0x060009C2 RID: 2498 RVA: 0x000394FC File Offset: 0x000376FC
	public void ResetMoveXZ()
	{
		Vector3 position = this.moveTrans.position;
		position.x = this.defPos.x;
		position.z = this.defPos.z;
		this.moveTrans.position = position;
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x060009C3 RID: 2499 RVA: 0x0003954C File Offset: 0x0003774C
	public void ResetMoveY()
	{
		Vector3 position = this.moveTrans.position;
		position.y = this.defPos.y;
		this.moveTrans.position = position;
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x060009C4 RID: 2500 RVA: 0x0003958C File Offset: 0x0003778C
	public void ResetYaw()
	{
		Vector3 eulerAngles = this.moveTrans.rotation.eulerAngles;
		eulerAngles.y = this.defRot.eulerAngles.y;
		this.moveTrans.rotation = Quaternion.Euler(eulerAngles);
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x060009C5 RID: 2501 RVA: 0x000395E0 File Offset: 0x000377E0
	public void ResetTrans()
	{
		this.moveTrans.position = this.defPos;
		this.moveTrans.rotation = this.defRot;
	}

	// Token: 0x060009C6 RID: 2502 RVA: 0x00039604 File Offset: 0x00037804
	public void MoveXZ(Vector2 move)
	{
		Vector3 vector = new Vector3(move.x, 0f, move.y);
		vector *= this.Speed();
		vector = this.camera.transform.TransformVector(vector);
		vector.y = 0f;
		this.moveTrans.position += vector;
	}

	// Token: 0x060009C7 RID: 2503 RVA: 0x00039670 File Offset: 0x00037870
	public void MoveY(Vector2 move)
	{
		Vector3 vector = new Vector3(0f, move.y, 0f);
		vector *= this.Speed();
		this.moveTrans.position += vector;
	}

	// Token: 0x060009C8 RID: 2504 RVA: 0x000396BC File Offset: 0x000378BC
	public void RotateYaw(Vector2 move)
	{
		float num = move.x * this.Speed() * 180f;
		Vector3 eulerAngles = this.moveTrans.rotation.eulerAngles;
		eulerAngles.y += num;
		this.moveTrans.rotation = Quaternion.Euler(eulerAngles);
	}

	// Token: 0x060009C9 RID: 2505 RVA: 0x00039714 File Offset: 0x00037914
	protected float Speed()
	{
		return Mathf.Lerp(this.minSpeed, this.maxSpeed, this.speedRate) * this.speedMul;
	}

	// Token: 0x040009B4 RID: 2484
	[SerializeField]
	protected Camera camera;

	// Token: 0x040009B5 RID: 2485
	[SerializeField]
	protected InputSliderUI speedSlider;

	// Token: 0x040009B6 RID: 2486
	[SerializeField]
	protected float minSpeed = 0.1f;

	// Token: 0x040009B7 RID: 2487
	[SerializeField]
	protected float maxSpeed = 10f;

	// Token: 0x040009B8 RID: 2488
	protected float speedRate = 0.5f;

	// Token: 0x040009B9 RID: 2489
	[SerializeField]
	protected float speedMul = 0.025f;

	// Token: 0x040009BA RID: 2490
	protected bool invoke = true;

	// Token: 0x040009BB RID: 2491
	protected Transform moveTrans;

	// Token: 0x040009BC RID: 2492
	protected Vector3 defPos;

	// Token: 0x040009BD RID: 2493
	protected Quaternion defRot;

	// Token: 0x0200017A RID: 378
	protected enum TARGET
	{
		// Token: 0x040009BF RID: 2495
		MAIN,
		// Token: 0x040009C0 RID: 2496
		VISITOR
	}
}
